#ifndef EPOLLER_H
#define EPOLLER_H 1
#include <vector>
#include <assert.h>
#include <string.h>

#include <sys/epoll.h>
#include <unistd.h>
class Epoller
{
public:
    Epoller(int maxEvent = 1024);
    ~Epoller();

    //unit32_t 只使用  int fd 也是为了对齐epoll_data 中的 uint32_t 字段
    bool AddFd_(int fd_,uint32_t events);
    bool ModFd_(int fd_,uint32_t events);
    bool DelFd_(int fd);

    int Wait_(int timeout = -1);
    int GetEventFd_(size_t i) const;
    uint32_t GetEvent_(size_t i) const;

private:
    int Epollfd_;
    std::vector<struct epoll_event> events_;  
};
#endif